#ifndef RECENTCONTACTEVENT_H
#define RECENTCONTACTEVENT_H

#include "abstractevent.h"

#include <QVariantList>
#include <QList>


class RecentContactEvent : public AbstractEvent
{
    Q_OBJECT

public:
    class Item
    {
    public:
        Item(qint64 friendId,
             qint64 lastContactTime,
             qint64 chid,
             QString message,
             QString name,
             int type);

    private:
        // list friend id for public chat
        qint64 m_friendId;
        qint64 m_lastContactTime;
        qint64 m_chid;
        QString m_message;
        QString m_name;
        int m_type;

    public:
        inline void setFriendId(qint64 friendId) {
            m_friendId = friendId;
        }

        inline qint64 friendId() const {
            return m_friendId;
        }

        inline void setLastContactTime(qint64 time) {
            m_lastContactTime = time;
        }

        inline qint64 lastContactTime() const {
            return m_lastContactTime;
        }

        inline void setChid(qint64 chid) {
            m_chid = chid;
        }

        inline qint64 getChid() const {
            return m_chid;
        }

        inline void setMessage(const QString &message) {
            m_message = message;
        }

        inline QString message() const {
            return m_message;
        }

        inline void setName(const QString &name) {
            m_name = name;
        }

        inline QString name() const {
            return m_name;
        }

        inline void setType(int type) {
            m_type = type;
        }

        inline int type() const {
            return m_type;
        }
    };

public:
    typedef QList<Item *> ItemList;

public:
    RecentContactEvent(const QVariantList &data, QObject *parent = 0);
    virtual ~RecentContactEvent();

private:
    ItemList m_itemList;

private:
    void parseList(const QVariantList &list);

public:
    void process();
    virtual AbstractEvent::EventType eventType() const;

public:
    inline const ItemList &itemList() const {
        return m_itemList;
    }
};

#endif // RECENTCONTACTEVENT_H
